import request from '@/utils/request'

/**
 * 分页查询数据
 * @param {Object} params
 */
export function dataListApi(params) {
  return request({
    url: '/api/role/data',
    method: 'get',
    params
  })
}

export function findByIdApi(id) {
  return request({
    url: '/api/role/'+id,
    method: 'get'
  })
}

// 新增
export function addApi(data) {
  return request({
    url: '/api/role',
    method: 'post',
    data: data
  })
}

// 修改
export function editApi(data) {
  return request({
    url: '/api/role',
    method: 'put',
    data: data
  })
}

// 删除
export function deleteApi(ids) {
  return request({
    url: '/api/role/' + ids,
    method: 'delete'
  })
}

  // 角色值是否唯一
  export function checkRoleNameUnique(params){
    return request({
      url: '/api/role/name/exists',
      method: 'get',
      params
    })
  }
  
  
  // 角色key是否唯一
  export function checkRoleKeyUnique(params){
    return request({
      url: '/api/role/key/exists',
      method: 'get',
      params
    })
  }
